<!DOCTYPE html>
<html lang="en">
<head>
    <title>资金日报表-四省详情</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-store, must-revalidate">
    <meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT">
    <meta http-equiv="expires" content="-1">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="shortcut icon" href="/dist/img/icon.png" type="image/x-icon">
    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="/dist/plugins/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="/dist/plugins/select2/select2.min.css">
    <link rel="stylesheet" href="/dist/css/font-awesome.min.css">
    <link rel="stylesheet" href="/dist/css/ionicons.min.css">
    <link rel="stylesheet" href="/dist/css/OA.min.css?t=86e2297f">
    <link rel="stylesheet" href="/dist/css/skins/OA-skins.min.css?t=222aea35">
    <style type="text/css">
        .leftFilter {
            float: left;
            text-align: left;
            margin-right: 5px;
        }

        .clickable {
            color: #489EF1;;
            cursor: pointer;
            text-align: left;
            font-weight: bold;
        }
        .topDiv{
            text-align: right;
            position: absolute;
            width: 100%;
            background: #fff;
            top: 0;
            left: 0;
            padding: 15px 20px;
            padding-bottom: 5px;
        }
        .tableTitle{
            background-color: #d2e8fd;
            font-weight: bold;
            color:#333;
            text-align: center;
            height: 24px;
            line-height: 24px;
        }
        .table>thead>tr>.tableTitle{
            background-color: #f8f8f8 !important;
        }
        .lineBg{
            background-color: #d2e8fd !important;
            padding: 0 !important;
        }
        table input{
            border:none;
            background:none;
            width: 100%;
            text-align: center;
        }
        .reginTd{
            max-width: 105px;
            overflow: hidden;
            text-overflow:ellipsis;
            white-space: nowrap;
            position: relative;
        }
        .div-td-content-more{
            position:absolute;
            height:auto;
            z-index:999;
            line-height:20px;
            background-color: #d3e8fd;
            padding: 8px 6px;
            border: 1px solid #e8e8ea;
            display:none;
        }
        .div-td-content-more i{
            width: 15px;
            height: 12px;
            background: url("/dist/img/more-icon.png");
            position: absolute;
            left:50px;
            top:-12px;
        }
    </style>
</head>
<body>
<section class="content" id="list">
    <div class="div-td-content-more"><i></i></div>
    <div class="topDiv">

        <input class="pull-left form-control pull-left input-sm" type="text" v-model="time" @focus="showDatePicker($event)" placeholder="请选择时间" style="width: 150px;">
        <button type="button" class="btn oaBtn btn-sm pull-left" @click="query">查询</button>
        <div class="leftFilter" style="width: 300px;margin-left: 5px;">
            <select v-model="bankChecked" class="form-control select2 companySelect" >
                <option value="">-银行账户快速定位-</option>
                <option v-for="option in bankList" :value="option.id">{{option.accountName}}</option>
                <!--<option v-for="option in listCompany" v-if="isNotBigCusCompany(option.name)" :value="option.id">-->
                <!--{{option.name}}-->
                <!--</option>-->
            </select>
        </div>
        <button v-if="type=='report'" type="button" class="btn oaBtn btn-sm pull-right" @click="goDetail('bankList')">银行卡列表</button>
        <!--<button type="button" class="btn oaBtn btn-sm pull-right" >导出</button>-->

        <div class="pull-right" style="height: 24px;line-height: 24px;margin-right: 10px;font-weight: bold;display: none;" >合计：0.00</div>
    </div>
    <div class="box-body no-padding iframeH3" style="margin-top:30px;overflow: auto;background: #fff;border-top: 1px solid #cbcbcd;
    border-bottom: 1px solid #cbcbcd">
        <div class="tableTitle">承兑汇票</div>
        <table class="table table-hover table-bordered" style="margin: -1px 0">
            <thead>
            <tr>
                <th style="width:6%;text-align: center" class="tableTitle">编号</th>
                <th style="width:7%;text-align: center" class="tableTitle">金额</th>
                <th style="width:13%;text-align: center" class="tableTitle">收入项目</th>
                <th style="width:7%;text-align: center" class="tableTitle">到期时间</th>
                <th style="width:11%;text-align: center" class="tableTitle">出票银行</th>
                <th style="width:6%;text-align: center" class="tableTitle">汇票号码</th>
                <th  class="lineBg" style="width:1%;text-align: center">&nbsp;</th>
                <th style="width:6%;text-align: center" class="tableTitle">编号</th>
                <th style="width:7%;text-align: center" class="tableTitle">金额</th>
                <th style="width:12%;text-align: center" class="tableTitle">支出项目</th>
                <th style="width:7%;text-align: center" class="tableTitle">到期时间</th>
                <th style="width:11%;text-align: center" class="tableTitle">出票银行</th>
                <th style="width:6%;text-align: center" class="tableTitle">汇票号码</th>
            </tr>
            </thead>
            <tbody style="text-align: right">
            <tr style="text-align: center" v-for="(item,i) in debits.list">
                <td>{{item.noIn}}</td>
                <td style="text-align: right">{{item.acpDraMoneyIn?fmoney(item.acpDraMoneyIn):""}}</td>
                <td style="text-align: left" class="reginTd">{{item.projectInfoIn}}</td>
                <td>{{item.maturityDateIn}}</td>
                <td>{{item.drawerBankIn}}</td>
                <td>{{item.acpDraNumberIn}}</td>
                <td class="lineBg"></td>
                <td >{{item.noOut}}</td>
                <td style="text-align: right">{{item.acpDraMoneyOut?fmoney(item.acpDraMoneyOut):""}}</td>
                <td style="text-align: left"  class="reginTd">{{item.projectInfoOut}}</td>
                <td>{{item.maturityDateOut}}</td>
                <td>{{item.drawerBankOut}}</td>
                <td>{{item.acpDraNumberOut}}</td>
            </tr>
            <tr style="text-align: right" v-cloak>
                <td style="text-align: center">收入合计</td>
                <td>{{debits.totalIncome?fmoney(debits.totalIncome):"0.00"}}</td>
                <td colspan="4"></td>
                <td class="lineBg"></td>
                <td style="text-align: center">支出合计</td>
                <td>{{debits.totaloutcome?fmoney(debits.totaloutcome):"0.00"}}</td>
                <td colspan="4"></td>
            </tr>
            <tr style="color:red;font-weight: bold;text-align: right;">
                <td style="text-align: center">合计</td>
                <td style="border-right: none;">{{debits.totalcount?fmoney(debits.totalcount):"0.00"}}</td>
                <td colspan="11" style="border-left:none;"></td>
            </tr>
            </thead>
        </table>

        <div style="margin-top:20px;" id="'div'+item.id" v-for="(item,i) in list">
            <div class="tableTitle">{{item.backCard}}</div>
            <table class="table table-hover table-bordered" style="margin: -1px 0">
                <thead>

                <tr>
                    <th style="width:6%;text-align: center" class="tableTitle">编号</th>
                    <th style="width:7%;text-align: center" class="tableTitle">金额</th>
                    <th style="width:37%;text-align: center" class="tableTitle">收入项目</th>
                    <th  class="lineBg" style="width:1%;text-align: center">&nbsp;</th>
                    <th style="width:6%;text-align: center" class="tableTitle">编号</th>
                    <th style="width:8%;text-align: center" class="tableTitle">金额</th>
                    <th style="width:36%;text-align: center" class="tableTitle">支出项目</th>
                </tr>

                </thead>
                <tbody>
                <tr style=";text-align: center;" v-for="(item2,i) in item.flowList" >
                    <td>{{item2.noIn}}</td>
                    <td style="text-align: right">{{item2.entryMoneyIn?fmoney(item2.entryMoneyIn):""}}</td>
                    <td style="text-align: left">{{item2.projectInfoIn}}</td>
                    <td class="lineBg"></td>
                    <td>{{item2.noOut}}</td>
                    <td style="text-align: right">{{item2.entryMoneyOut?fmoney(item2.entryMoneyOut):""}}</td>
                    <td style="text-align: left">{{item2.projectInfoOut}}</td>

                </tr>
                <tr style=";text-align: right" v-cloak>
                    <td style="text-align: center">收入合计</td>
                    <td>{{item.totalIncome?fmoney(item.totalIncome):"0.00"}}</td>
                    <td ></td>
                    <td class="lineBg"></td>
                    <td style="text-align: center">支出合计</td>
                    <td>{{item.totalPay?fmoney(item.totalPay):"0.00"}}</td>
                    <td ></td>
                </tr>
                <tr style="font-weight: bold;text-align: right;" v-cloak>
                    <td style="text-align: center">昨日余额</td>
                    <td style="border-right: none;">{{item.yestdayBalance?fmoney(item.yestdayBalance):"0.00"}}</td>
                    <td style="border-left:none;"></td>
                    <td class="lineBg"></td>
                    <td style="text-align: center;color:red;">今日余额</td>
                    <td style="border-right: none;">{{item.dynamicMoney?fmoney(rmoney(item.dynamicMoney)):"0.00"}}</td>
                    <td style="border-left:none;"></td>
                </tr>
                </tbody>
            </table>
        </div>
    </div>

    <!-- /.box-body -->
</section>
<script src="https://file.ggxqce.com/web/jquery-2.2.3.min.js"></script>
<!--插件JS-->
<script src="https://file.ggxqce.com/web/bootstrap.min.js"></script>
<!--框架已定义 JS-->
<script src="/dist/js/app_iframe.js?t=8e743a31"></script>
<!--oa自定义  JS-->
<script src="/dist/js/oa.js?t=54c6b89c"></script>
<script src="https://file.ggxqce.com/web/vue.min.js"></script>
<script type="text/javascript" src="/dist/plugins/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="/dist/plugins/lhgdialog/lhgdialog.min.js?self=true"></script>
<script type="text/javascript" src="/dist/plugins/select2/select2.full.min.js"></script>
<script>
    $(function () {
        $("body").on("click",".reginTd",function(e) {
            var text =$(this).text();
            if(text != "") {
                text="<i></i>"+text;
                $(".div-td-content-more").html(text).css({
                    "width": $(this).outerWidth() + "px",
                    "left": $(this).offset().left,
                    "top": ($(this).offset().top + $(this).outerHeight()) + "px"
                }).show();
                e.stopPropagation();
            }
        });
        $("body").on("click",".div-td-content-more",function (e) {
            e.stopPropagation();
        });
        $("body").on("click",function () {
            $(".div-td-content-more").hide();
        });
    });
</script>
<script type="text/javascript">
    Vue.directive('select2', {
        inserted: function (el, binding, vnode) {
            var options = binding.value || {};

            $(el).select2(options).on("select2:select", function (e) {
                el.dispatchEvent(new Event('change', {target: e.target})); //说好的双向绑定，竟然不安套路
            });
        },
        update: function (el, binding, vnode) {
            $(el).trigger("change");
        }
    });
    var app = new Vue({
        el: '#list',
        data: {
            bankList:[{"bankName":"","id":""}],
            type:$.wyui.page.urlParams.type,
            bankChecked:"",
            time:new Date().Format("yyyy-MM-dd"),
            list:[],
            debits:{
                totalIncome:"",
                totaloutcome:"",
                totalcount:"",
                list:[]
            },
            companyId:"",
            oldData:"",
            companyList:'',
            queryCompanyId:"",
            isEdit:false
        },
        methods: {
            fmoney:function(s,n){
                n = n > 0 && n <= 20 ? n : 2;
                s = parseFloat((s + "").replace(/[^\d\.-]/g, "")).toFixed(n) + "";
                var l = s.split(".")[0].split("").reverse(), r = s.split(".")[1],
                    t = "";
                for (i = 0; i < l.length; i++) {
                    t += l[i] + ((i + 1) % 3 == 0 && (i + 1) != l.length ? "," : "");
                }
                return t.split("").reverse().join("") + "." + r;
            },
            rmoney:function (s) {
                if (s == 0)
                    return 0;
                else
                    return parseFloat(s.replace(/[^\d\.-]/g, ""));
            },
            showDatePicker: function (e) {
                var that = this;
                WdatePicker({
                    onpicked: function (dp) {
                        that.time = dp.cal.getNewDateStr();
                        return true;
                    },
                    //dateFmt:'yyyy-MM-dd HH:mm'
                });
                $(e.target).blur();
            },
            getIndex:function (cap1,cap2) {
                var that=this;
                var cap=cap1;
                if(!cap1){cap=cap2}
                for(var i=0;i<that.list.length;i++){
                    if(that.list[i].id==cap){
                        return i;
                    }
                }
            },
            getCount:function (arr,key) {
                var number=0;
                for (var i = arr.length - 1; i >= 0; i--) {
                    number+=(arr[i][key]?Number(arr[i][key]):0)
                }
                return number;
            },
            getAllCounnt:function (arr,type) {
                var that=this;
                if(type=="1"){
                    that.debits.totalIncome=that.getCount(that.debits.list,"acpDraMoneyIn");
                    that.debits.totaloutcome=that.getCount(that.debits.list,"acpDraMoneyOut");
                    that.debits.totalcount=Number(that.debits.totalIncome)-Number(that.debits.totaloutcome);
                }else{
                    for(var a=0;a<arr.length;a++){
                        that.list[a].totalIncome=that.getCount(that.list[a].flowList,"entryMoneyIn");
                        that.list[a].totalPay=that.getCount(that.list[a].flowList,"entryMoneyOut");
                        that.list[a].yestdayBalance=Number(that.list[a].dynamicMoney)-Number(that.list[a].totalIncome)+Number(that.list[a].totalPay);
                    }
                }
            },
            getList:function () {
                var that=this;
                $.ajax({
                    url: "http://60.205.143.20:5758/FundWS.asmx/GetEachBackTitle?jsoncallback=?",
                    dataType: "jsonp",
                    jsonp: "jsoncallback",
                    data: { provinceInfo: that.companyName ,date:that.time},
                    success: function (data) {
                        var list=data.JSON;
                        for(var i=0;i<list.length;i++){
                            list[i].flowList=[];
                            list[i].totalIncome='';
                            list[i].totalPay='';
                           list[i].yestdayBalance='';
                        }
                        that.list=list;
                        $.ajax({
                            url: "http://60.205.143.20:5758/FundWS.asmx/GetEachBackList?jsoncallback=?",
                            dataType: "jsonp",
                            jsonp: "jsoncallback",
                            data: { provinceInfo: that.companyName ,date:that.time},
                            success: function (data) {
                                var flowList=data.cashJSON;
                                console.log(flowList)
                                for(var i=0;i<flowList.length;i++){
                                    var num=that.getIndex(flowList[i].capAccountIdIn,flowList[i].capAccountIdOut)
                                    that.list[num].flowList.push(flowList[i])
                                }
                                that.getAllCounnt(that.list,2)
                            },
                            error: function (e) {
                                alert("初始化银行下拉框失败，请重新打开！" + e.responseText);
                            }
                        });
                    },
                    error: function (e) {
                        alert("初始化银行下拉框失败，请重新打开！" + e.responseText);
                    }
                });
            },
            loadAccBillList:function () {
                var that=this;
                $.ajax({
                    url: "http://60.205.143.20:5758/FundWS.asmx/GetAccBillList?jsoncallback=?",
                    dataType: "jsonp",
                    jsonp: "jsoncallback",
                    data: { provinceInfo: that.companyName ,date:that.time},
                    success: function (data) {
                        that.debits.list=data.accBillJSON;
                        that.getAllCounnt(data.accBillJSON,1);
                    },
                    error: function (e) {
                        alert("初始化银行下拉框失败，请重新打开！" + e.responseText);
                    }
                });

            },
            initCollBank:function () {
              var that=this;
                $.ajax({
                    url: "http://60.205.143.20:5758/FundWS.asmx/GetBankList?jsoncallback=?",
                    dataType: "jsonp",
                    jsonp: "jsoncallback",
                    data: { provinceInfo: that.companyName },
                    success: function (data) {
                        that.bankList=data;



                    },
                    error: function (e) {
                        alert("初始化银行下拉框失败，请重新打开！" + e.responseText);
                    }
                });
            },
            goDetail:function(type){
                var that=this;
                switch (type){
                    case "bankList":
                        url = "reportForm/capital/accountList.html?formReport=1&companyId="+that.companyId;
                        top.closeTabByPageId("accountList");
                        top.addTabs({id:"accountList",title:"银行卡资金列表",close: true,url:url});
                        break;
                    default:
                        break;
                }
            },
            query:function () {

                this.initCollBank();
                this.loadAccBillList();
                this.getList();
            }

        },

        mounted: function () {
            var that = this;

            that.companyName=$.wyui.page.urlParams.companyName;
            if($.wyui.page.urlParams.time){
                that.time=$.wyui.page.urlParams.time
            }else{
                that.time=new Date().Format("yyyy-MM-dd")
            }
            that.initCollBank();
            that.loadAccBillList();
            that.getList();


            $(".select2").select2();
            $(".select2").select2().on('select2:select', function (e) {
                var clazz = $(this).attr("class");
                if(clazz.indexOf("queryId")>-1){
                    that.companyId=$(this).val();
                }
                else if (clazz.indexOf("company") > -1){
                    that.bankChecked = $(this).val();
                    var id="div"+that.bankChecked;
                    var container = $('.iframeH3'),
                        scrollTo = $('#'+id);
                    container.animate({
                        scrollTop: scrollTo.offset().top - container.offset().top + container.scrollTop()
                    })
                }
                else if (clazz.indexOf("brand") > -1){that.brandChecked = $(this).val();}
                else if (clazz.indexOf("month") > -1){that.monthChecked = $(this).val();}
                else if (clazz.indexOf("exhibitionType") > -1){
                    that.exhibitionTypeChecked = $(this).val();
                }
                that.pageIndex = 1;

            });

        }
    });


</script>

</body>
</html>